forum

Home / DeveloperSection / Forums / Get List of all users from Openfire Server in Android

Get List of all users from Openfire Server in Android

zack mathews 2209 10-Dec-2015
Hello i am developing a chat app in android using xmpp and open-fire for server, currently i can create new user and login with that user.i have searched a lot of on net and tried different solutions but nothing is worked.

At server all users are automatically get added to one default group. when new user get created.but i am unable to get list of all users until i will add them to my roster.

my requirement is to show all user's list and allow user to add friend from them, how to get all users list those who are not my friend?

i have tried to get list of users from group, but still no success, i can only retrieve list of users those are my friends with following code.

Roster roster = xmppConnection.getRoster();
        Collection<RosterEntry> entries = roster.getEntries();
            for(RosterEntry entry1 : entries)
            {
                System.out.println("UserID:- " + entry1.getUser());
                System.out.println("Name:- " + entry1.getName());
                System.out.println("Status:- " + entry1.getStatus());
                System.out.println("type:- " + entry1.getType());   
            }
to retrieve user entry from group i used following code

    Roster roster = xmppConnection.getRoster();
    Collection<RosterGroup> groups = roster.getGroups();
    for(RosterGroup group: groups )
            {
                System.out.println("Group Name:- " + group.getName());
            Collection<RosterEntry> entries = roster.getEntries();
            for(RosterEntry entry1 : entries)
            {
                System.out.println("UserID:- " + entry1.getUser());
                System.out.println("Name:- " + entry1.getName());
                System.out.println("Status:- " + entry1.getStatus());
                System.out.println("type:- " + entry1.getType());   
            }   
        }
any help/solution or suggestion to get all users list is appreciated.

Thank you.

Updated on 10-Dec-2015

Can you answer this question?


Answer

1 Answers

Liked By